/*
 * Ken Anderson, 2009
 */

#ifndef UTIL_H
#define UTIL_H

// Common definitions & functions used across the program.

#include <time.h>

#define RANDOM_SEED 1

#define FATAL		true
#define CRITICAL	true
#define NORMAL		true
#define DEBUG		false
#define TRACE		false

#define PI 3.14159f

enum Errors {
	ERROR_NORMAL = 0,
	ERROR_SEARCH_COULDNT_FIND_NODE_ID,
	ERROR_ANOTHER_ERROR
};

inline float Mod( float numerator, const float & denominator )
{
	while( numerator < 0.0 )
		numerator += denominator;
	while( numerator > denominator )
		numerator -= denominator;
	return numerator;
}

inline bool aboutEqualTo( float num1, float num2 )
{
	static float THRESHOLD = 0.0001f;
	if( ( num1 <= num2 + THRESHOLD ) && ( num1 >= num2 - THRESHOLD ) )
		return true;
	return false;
}

#endif
